# Speech-to-Text and Text-to-Speech Unity Project

This Unity project utilizes the Hugging Face SDK for speech-to-text, interacts with Open Router for processing the transcribed text, and converts the response from text to speech using AWS services.

## Prerequisites

1. **Unity:**
   - Install Unity from the [Unity Hub](https://unity3d.com/get-unity/download).

2. **API Keys:**
   - Obtain the following API keys:
      - Open Router API Key
      - AWS Access Key
      - AWS Secret Key

## Getting Started

1. **Clone the Repository:**
   - Clone this repository to your local machine.

2. **Open Unity Hub:**
   - Launch Unity Hub and add the project by selecting the project's root folder.

3. **Inspector Variables:**
   - Open the Unity Editor.
   - Navigate to the script or GameObject handling the API calls.
   - In the Inspector, locate the following public variables:
      - `openRouterApiKey` - Open Router API Key (leave it empty for now)
      - `awsAccessKey` - AWS Access Key (leave it empty for now)
      - `awsSecretKey` - AWS Secret Key (leave it empty for now)

4. **Fill in API Keys:**
   - Fill in the empty fields in the Inspector with your actual API keys.

5. **Run the Unity Project:**
   - Click the "Play" button in the Unity Editor to run the project.

6. **Usage:**
   - Use the provided **Start** and **Stop** buttons to record user speech.
   - Speech-to-text updates on a widget, and a script polls the widget's text until it changes.
   - The Open Router API sends back three responses. Currently, a counter is used to only retrieve the third one.

7. **Optimizing Open Router API Responses:**
   - To optimize Open Router API response handling:
     - Examine the API responses to identify relevant information.
     - Modify the script to intelligently retrieve the desired response without relying on a counter.

## Important Notes:

- **Security Concerns:**
  - Treat your API keys with confidentiality. Never expose them publicly in production.
  - For security reasons, use more secure methods, such as environment variables or a secure configuration system, in a production environment.

- **Troubleshooting:**
  - If you encounter issues, check the console in the Unity Editor for error messages.
  - Ensure your API keys are correctly filled in the Inspector.

- **Contributing:**
  - Feel free to contribute to the project by submitting issues or pull requests.

---
